<template>
	<view>
		<view class="fixed-box">
			<view class="fixedbox">
				<image class="bg" src="http://img.curiousmore.com/tmp/wx2f4eaeb7b745ba4e.o6zAJs2bel8UMMafp-gtnT7OfHzo.MbnTEnikWqPN47b36d29885799816e6230755e5a108f.png" mode=""></image>
				<view class="head">
					<view class="head_left1" @tap="back()">
						<image src="../../../static/wode/return1.png" mode=""></image>
						<text>我的</text>
					</view>
					<!-- <text>助学中心</text>
					<text class="head_right1"></text> -->
				</view>
				<view class="card">
					<uni-swiper-dot :info="info" :current="current" field="content" :mode="mode" :dotsStyles="dotsStyles">
						<swiper class="swiper-box" @change="change">
							<swiper-item v-for="(item ,index) in info" :key="index">
								<view class="swiper-item" :class="item.colorClass">
									<video class="video_box" :src="item.url" mode="aspectFill" controls></video>
								</view>
								<view class="language">
									{{item.name}}
								</view>
							</swiper-item>
						</swiper>
					</uni-swiper-dot>
				</view>
				<view class="menu_box">
					<view class="" @tap="selectMenu(index)" :class="{fontActive:index===menuIndex}" v-for="(item,index) in menuList"
					 :key="index">
						{{item}}
						<view v-show="menuIndex===index" class="data-active"></view>
					</view>
				</view>

			</view>
		</view>
		<view class="" v-if="menuIndex==0">
			<view class="first_box">
				<view class="message_box" v-for="(item,index) in allUserData" :key="index">
					<view class="message_item">
						{{item.typeText}}
					</view>
					<view class="message_item">
						<text>评分</text>
						<view class="pingfen">
							<uni-rate disabled="true" :value="item.score"></uni-rate>
							<text>{{item.score}}</text>
						</view>
					</view>
					<view class="message_me">
						<text>自我介绍</text>
						<view class="me_body">{{item.introduction}}</view>
					</view>
				</view>
			</view>
			<view class="message_box" v-if="userData.relevant_information!=''">
				<view class="mid_item">
					<view class="proveText">相关证明资料</view>
					<image v-for="(item,index) in userData.relevant_information" :key="index" class="selected-img" :src="item"></image>
				</view>
			</view>
			<!-- <view class="message_box " v-if="userData.teach_language!=''">
				<view class="mid_item">
					<view class="body_top_item ">
						<text class="text3">教学语言</text>
						<view class="body_item_right">
							<text class="">{{userData.teach_language}}</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<video class="selected-img" v-for="(item,index) in userData.teach_language_url" :key="index" :src="item" mode=""></video>
				</view>
			</view>
			<view class="message_box" v-if="userData.mother_tongue!=''">
				<view class="mid_item">
					<view class="body_top_item ">
						<text class="text3">母语</text>
						<view class="body_item_right">
							<text class="">{{userData.mother_tongue}}</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<video class="selected-img" v-for="(item,index) in userData.mother_tongue_url" :key="index" :src="item" mode=""></video>
				</view>
			</view> -->
			<view class="message_box" v-if="userData.language!=''">
				<view class="mid_item">
					<view class="body_top_item ">
						<text class="text3">掌握语言</text>
						<view class="body_item_right">
							<text class="">{{userData.language}}</text>
							<image src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					<video class="selected-img" v-for="(item,index) in userData.language_url" :key="index" :src="item" mode=""></video>
				</view>
			</view>
			<view class="btn_box">
				<view class="btn">
					聊一聊
				</view>
			</view>
		</view>
		<view class="first_box" v-else-if="menuIndex==1">
			<view class="teble_box">
				<view class="teble_item">
					<view class="title_left">
						<text>{{yearDate}}年{{monthDate}}月</text>
					</view>
					<view class="title_right">
						<view class="title_week" @tap="isShowWeek">
							<text>{{week}}</text>
							<image src="../../../static/wode/greenDown.png" mode=""></image>
							<view v-if="showWeek==true">
								<view class="week_box">
									<text v-for="(item,index) in weekList" :key="index" @tap="chooseWeek(index,'2')">{{item}}</text>
								</view>
							</view>
						</view>
						<view class="title_class">
							课节
						</view>
					</view>
				</view>
				<view class="teble_item" v-for="(item,index) in dayList" :key="index">
					<view class="class_day">
						<text>{{item.weekDay}}</text>
						<text class="text_day">({{item.date}}号)</text>
					</view>
					<view class="class_anpai">
						<text>课程安排></text>
					</view>
					<view class="class_big">
						<view class="class_box" v-for="(item1,index1) in item.classLine" :key="index1">
							<view class="class_item">
								<view v-if="item1[0]!=undefined&&item1[0]!=''">
									<view class="status1" v-if="item1[0].status==1" @tap="showMessage(item1[0],index1,'0',index)" :class="{active:selectIndex==index1&&selectIndex2=='0'&&selectIndex3==index}">
										<text>已取消</text>
										<text>{{item1[0].timeNum}}</text>
									</view>
									<view class="status2" v-else-if="item1[0].status==2" @tap="showMessage(item1[0],index1,'0',index)" :class="{active:selectIndex==index1&&selectIndex2=='0'&&selectIndex3==index}">
										{{item1[0].timeNum}}
									</view>
									<view class="status1 status3" v-else-if="item1[0].status==3" @tap="showMessage(item1[0],index1,'0',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='0'&&selectIndex3==index}">
										<text>已结束</text>
										{{item1[0].timeNum}}
									</view>
									<view class="status1 status4" v-else-if="item1[0].status==4" @tap="showMessage(item1[0],index1,'0',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='0'&&selectIndex3==index}">
										<text>修改申请中</text>
										{{item1[0].timeNum}}
									</view>
									<view class="status1 status5" v-else-if="item1[0].status==5" @tap="showMessage(item1[0],index1,'0',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='0'&&selectIndex3==index}">
										<text>取消预约申请中</text>
										{{item1[0].timeNum}}
									</view>
									<view class="status1 status3" v-else-if="item1[0].status==6" @tap="showMessage(item1[0],index1,'0',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='0'&&selectIndex3==index}">
										<text>已逾期</text>
										{{item1[0].timeNum}}
									</view>
								</view>
								<view v-else></view>
							</view>
							<view class="class_item">
								<view v-if="item1[1]!=undefined&&item1[1]!=''">
									<view class="status1" v-if="item1[1].status==1" @tap="showMessage(item1[1],index1,'1',index)" :class="{active:selectIndex==index1&&selectIndex2=='1'&&selectIndex3==index}">
										<text>已取消</text>
										<text>{{item1[1].timeNum}}</text>
									</view>
									<view class="status2" v-else-if="item1[1].status==2" @tap="showMessage(item1[1],index1,'1',index)" :class="{active:selectIndex==index1&&selectIndex2=='1'&&selectIndex3==index}">
										<text>{{item1[1].timeNum}}</text>
									</view>
									<view class="status1 status3" v-else-if="item1[1].status==3" @tap="showMessage(item1[1],index1,'1',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='1'&&selectIndex3==index}">
										<text>已结束</text>
										<text>{{item1[1].timeNum}}</text>
									</view>
									<view class="status1 status4" v-else-if="item1[1].status==4" @tap="showMessage(item1[1],index1,'1',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='1'&&selectIndex3==index}">
										<text>修改申请中</text>
										<text>{{item1[1].timeNum}}</text>
									</view>
									<view class="status1 status5" v-else-if="item1[1].status==5" @tap="showMessage(item1[1],index1,'1',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='1'&&selectIndex3==index}">
										<text>取消预约申请中</text>
										<text>{{item1[1].timeNum}}</text>
									</view>
									<view class="status1 status3" v-else-if="item1[1].status==6" @tap="showMessage(item1[1],index1,'1',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='1'&&selectIndex3==index}">
										<text>已逾期</text>
										<text>{{item1[1].timeNum}}</text>
									</view>
								</view>
								<view v-else></view>
							</view>
							<view class="class_item">
								<view v-if="item1[2]!=undefined&&item1[2]!=''">
									<view class="status1" v-if="item1[2].status==1" @tap="showMessage(item1[2],index1,'2',index)" :class="{active:selectIndex==index1&&selectIndex2=='2'&&selectIndex3==index}">
										<text>已取消</text>
										<text>{{item1[2].timeNum}}</text>
									</view>
									<view class="status2" v-else-if="item1[2].status==2" @tap="showMessage(item1[2],index1,'2',index)" :class="{active:selectIndex==index1&&selectIndex2=='2'&&selectIndex3==index}">
										<text>{{item1[2].timeNum}}</text>
									</view>
									<view class="status1 status3" v-else-if="item1[2].status==3" @tap="showMessage(item1[2],index1,'2',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='2'&&selectIndex3==index}">
										<text>已结束</text>
										<text>{{item1[2].timeNum}}</text>
									</view>
									<view class="status1 status4" v-else-if="item1[2].status==4" @tap="showMessage(item1[2],index1,'2',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='2'&&selectIndex3==index}">
										<text>修改申请中</text>
										<text>{{item1[2].timeNum}}</text>
									</view>
									<view class="status1 status5" v-else-if="item1[2].status==5" @tap="showMessage(item1[2],index1,'2',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='2'&&selectIndex3==index}">
										<text>取消预约申请中</text>
										<text>{{item1[2].timeNum}}</text>
									</view>
									<view class="status1 status3" v-else-if="item1[2].status==6" @tap="showMessage(item1[2],index1,'2',index)"
									 :class="{active:selectIndex==index1&&selectIndex2=='2'&&selectIndex3==index}">
										<text>已逾期</text>
										<text>{{item1[2].timeNum}}</text>
									</view>
								</view>
								<view v-else></view>
							</view>
						</view>
					</view>
			
				</view>
			</view>
		</view>
		<view class="first_box" v-else-if="menuIndex==2">
			<view class="" v-if="commentList.length!=0">
				<view class="comment_box" v-for="(item,index) in commentList" :key="index">
					<text class="comment_title">{{item.map.appointmentinfo.title}} {{item.time}}</text>
					<view class="comment_people">
						<image class="headImg" :src="item.map.userinfo.avatar" mode=""></image>
						<view class="people_right">
							<view class="name_box">
								<text>{{item.map.userinfo.nick_name}}</text>
								<text class="margin2">{{item.creat_time}}</text>
							</view>
							<view class="grade_box">
								<uni-rate disabled="true" size="12" :value="item.score"></uni-rate>
								<text class="margin2">{{item.score}}</text>
							</view>
						</view>
					</view>
					<view class="comment_first">
						{{item.content}}
					</view>
					<view class="comment_two" v-if="item.map.subComment.length!=0">
						<view class="name_box">
							助学师<text class="returnto">回复</text>{{item.map.subComment[0].map.replayinfo.nick_name}}
						</view>
						<view class="">
							<text class="text4">{{item.map.subComment[0].content}}</text>
							<text class="time">{{item.map.subComment[0].create_time}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="noList" v-else>
				暂无评论
			</view>
		</view>
	</view>
</template>

<script>
	import uniSwiperDot from '@/components/uni-swiper-dot.vue'
	import uniRate from "@/components/uni-rate/uni-rate.vue"
	import uniIcon from "@/components/uni-icon/uni-icon.vue"
	export default {
		components: {
			uniSwiperDot,
			uniRate,
			uniIcon
		},
		data() {
			return {
				id: '', //查看用户id
				menuList: ['简介', '课程', '评论'],
				menuIndex: 0,
				info: [
					// {
					// 	content: 1
					// },
					// {
					// 	content: 2
					// },
					// {
					// 	content: 3
					// }
				],
				current: 0,
				mode: 'default',
				userData: '', //用户资料
				type: '', //点进来时助学师类型
				allUserData: '', //助学师所有资料
				allLanguage: '', //所有语言
				showWeek: false,
				state: {},
				weekList: ['第一周', '第二周', '第三周', '第四周', '第五周', '第六周'],
				week: '第一周',
				dayList: [],
				yearDate: '',
				monthDate: '',
				showStudent: false,
				selectIndex: '', //小行索引
				selectIndex2: '', //列索引
				selectIndex3: '', //大行索引
				commentList:[],//评论列表
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.type = option.type;
			this.getData()
			this.getAllData()
		},
		methods: {
			getData() {
				var me = this;
				var data = {
					user_id: this.id,
					type: this.type
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'masterInfo',
					actionName: 'queryListPage',
					data: data,
					successBack: function(res) {
						console.log(res, '助学师资料')
						me.userData = res.data.data[0]

						if (me.userData.teach_language_url != '') {
							me.userData.teach_language_url = me.userData.teach_language_url.split(',')
							me.userData.teach_language = me.userData.teach_language.split(',')
							for (var i = 0; i < me.userData.teach_language_url.length; i++) {
								var obj = {};
								obj.url = me.userData.teach_language_url[i];
								obj.name = me.userData.teach_language[i]
								me.info.push(obj)
							}

						}
						if (me.userData.mother_tongue_url != '') {
							me.userData.mother_tongue_url = me.userData.mother_tongue_url.split(',')
							me.userData.mother_tongue = me.userData.mother_tongue.split(',')
							for (var j = 0; j < me.userData.mother_tongue_url.length; j++) {
								var obj = {};
								obj.url = me.userData.mother_tongue_url[j];
								obj.name = me.userData.mother_tongue[j]
								me.info.push(obj)
							}
						}
						if (me.userData.language_url != '') {
							me.userData.language_url = me.userData.language_url.split(',')
							me.userData.language = me.userData.language.split(',')
							for (var a = 0; a < me.userData.language_url.length; a++) {
								var obj = {};
								obj.url = me.userData.language_url[a];
								obj.name = me.userData.language[a]
								me.info.push(obj)
							}
						}
						if(me.userData.relevant_information!=''){
							me.userData.relevant_information=me.userData.relevant_information.split(',')
						}
					},
				})
			},
			getAllData() {
				var me = this;
				var data = {
					user_id: this.id
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'masterInfo',
					actionName: 'queryListPage',
					data: data,
					successBack: function(res) {
						console.log(res, '所有资料')
						me.allUserData = res.data.data;
						var allLanguages = [];
						for (var i = 0; i < me.allUserData.length; i++) {
							if (me.allUserData[i].type == 'private_education') {
								me.allUserData[i].typeText = '私教'
							} else if (me.allUserData[i].type == 'mother_tongue') {
								me.allUserData[i].typeText = '母语助学师'
							} else if (me.allUserData[i].type == 'cross_border') {
								me.allUserData[i].typeText = '跨境助学师'
							} else if (me.allUserData[i].type == 'major') {
								me.allUserData[i].typeText = '专业助学师'
							}

							if (me.allUserData[i].score.toString().indexOf('.') == -1) {
								me.allUserData[i].score = me.allUserData[i].score + '.0'
							}
							var arr = [];
							arr.push(me.allUserData[i].typeText, me.allUserData[i].teach_language.split(','));
							allLanguages.push(me.allUserData[i].teach_language.split(','));
							arr = me.flatten(arr);
							arr = me.removalArr(arr);
							me.allUserData[i].typeText = arr.join('/');
						}
						allLanguages = me.flatten(allLanguages);
						allLanguages = me.removalArr(allLanguages);
						me.allLanguage=allLanguages.join('、');
					}
				})
			},
			removalArr(arr) { //去重
				var arrs = [];
				for (var b = 0; b < arr.length; b++) {
					if (arr[b] != "") {
						if (arrs.indexOf(arr[b]) == -1) {
							arrs.push(arr[b])
						};
					}

				}
				return arrs;
			},
			flatten(arr) { //数组扁平化
				while (arr.some(item => Array.isArray(item))) {
					arr = [].concat(...arr);
				}
				return arr;
			},
			selectMenu(index) {
				this.menuIndex = index
				if(this.menuIndex==0){
					this.getAllData()
				}else if(this.menuIndex==1){
					this.showDate()

					this.getClass()
				}else if(this.menuIndex==2){
					this.getComment()
				}
			},
			getClass() { //查课程表
				var me = this;
				var d = new Date();
				var startY = this.yearDate;
				var startM = '';
				var startD = '';
				var endY = '';
				var endM = '';
				var endD = '';
				if (this.monthDate < 10) {
					startM = '0' + this.monthDate
				} else {
					startM = this.monthDate
				}
				if (this.dayList[0].date < 10) {
					startD = '0' + this.dayList[0].date
				} else {
					startD = this.dayList[0].date
				}
				// 该月天数
				d.setFullYear(this.yearDate, this.monthDate, 0);
				var dd = d.getDate();
				if (this.dayList[0].date + 6 > dd) {
					if (this.monthDate + 1 > 12) {
						endY = this.monthDate + 1
						endM = 1
					} else {
						endM = this.monthDate + 1
						endY = startY
					}
					endD = this.dayList[0].date + 7 - dd
			
				} else {
					endY = startY;
					endM = this.monthDate;
					endD = this.dayList[0].date + 7
				}
				if (endM < 10) {
					endM = '0' + endM
				}
				if (endD < 10) {
					endD = '0' + endD
				}
				var data = {
					master_id: this.id,
					start_time: startY + '-' + startM + '-' + startD + ' ' + '00:00:00',
					end_time: endY + '-' + endM + '-' + endD + ' ' + '00:00:00',
					offset: (new Date().getTimezoneOffset() / 60) * -1,
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'masterAppointment',
					actionName: 'querySchedule',
					data: data,
					successBack: function(res) {
			
						me.classList = res.data.data
						if (me.classList.length != 0) {
							for (var a = 0; a < me.dayList.length; a++) {
								me.dayList[a].timeNumList = []
								me.dayList[a].timeNumItem = []
								me.dayList[a].classLine = []
							}
							for (var i = 0; i < me.classList.length; i++) {
								if (me.classList[i].status == 2) {
									var timestamp = Date.parse(new Date());
									var data = new Date(me.classList[i].end_time)
									var time1 = data.getTime()
									if (time1 < timestamp) {
										me.classList[i].status = 6
									}
								}
			
								me.classList[i].start_time = me.classList[i].start_time.split(' ')
								me.classList[i].end_time = me.classList[i].end_time.split(' ')
								var dayNum = me.classList[i].start_time[0].substr(me.classList[i].start_time[0].length - 2, 2)
			
								var timeNum = me.classList[i].start_time[1].substr(0, 5) + '~' + me.classList[i].end_time[1].substr(0, 5)
			
								me.classList[i].timeNum = timeNum
								for (var j = 0; j < me.dayList.length; j++) {
									if (me.dayList[j].date == dayNum) { //把对应日期的课程加到数组里
										me.dayList[j].timeNumList.push(me.classList[i])
										me.dayList[j].timeNumItem.push(timeNum)
									}
			
									me.dayList[j].classLine = [];
									for (var c = 0; c < me.dayList[j].timeNumList.length; c += 3) {
										me.dayList[j].classLine.push(me.dayList[j].timeNumList.slice(c, c + 3));
			
									}
								}
							}
						} else {
							for (var i = 0; i < me.dayList.length; i++) {
								me.dayList[i].classLine = [1]
							}
						}
						me.showWeek = true
						me.showWeek = false
						console.log(me.dayList, '课程资料')
					},
				})
			},
			getComment() {
				var me = this;
				var data = {
					user_id: this.id,
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'masterComment',
					actionName: 'queryListPage',
					data: data,
					successBack: function(res) {
						console.log(res, '评论')
						me.commentList = res.data.data
						for (var i = 0; i < me.commentList.length; i++) {
							me.commentList[i].map.appointmentinfo.start_time = me.commentList[i].map.appointmentinfo.start_time.split(' ')
							me.commentList[i].map.appointmentinfo.end_time = me.commentList[i].map.appointmentinfo.end_time.split(' ')
							me.commentList[i].time = me.commentList[i].map.appointmentinfo.start_time[0].substr(5, 5).replace('-', '月') +
								'日' + ' ' + me.commentList[
									i].map.appointmentinfo.start_time[1].substr(0, 5) + '~' + me.commentList[i].map.appointmentinfo.end_time[1]
								.substr(0, 5)
							me.commentList[i].create_time = me.commentList[i].create_time.replace(/-/g, '.').substr(0, 10)
						}
					}
				})
			},
			showMessage(item, index1, index2, index3) {
				console.log(this.showStudent)
				if (this.selectIndex == index1 && this.selectIndex2 == index2 && this.selectIndex3 == index3) {
					if (this.showStudent == true) {
						this.showStudent = false;
						this.selectIndex = '';
						this.selectIndex2 = '';
						this.selectIndex3 = '';
					} else {
						this.showStudent = true;
						this.selectIndex = index1;
						this.selectIndex2 = index2;
						this.selectIndex3 = index3;
			
					}
				} else {
					this.showStudent = true;
					this.selectIndex = index1;
					this.selectIndex2 = index2;
					this.selectIndex3 = index3;
				}
				this.classItem = item
				this.studentItem = this.classItem.map.userinfo
				console.log(this.classItem)
			
			},
			getWeeks(year, month) { //当前月有几周
				var d = new Date();
				// 该月第一天
				d.setFullYear(year, month - 1, 1);
				var w1 = d.getDay();
				if (w1 == 0) w1 = 7;
				// 该月天数
				d.setFullYear(year, month, 0);
				var dd = d.getDate();
				// 第一个周一
				let d1;
				if (w1 != 1) d1 = 7 - w1 + 2;
				else d1 = 1;
				let week_count = Math.ceil((dd - d1 + 1) / 7);
				return week_count;
			},
			getWeekTime(year, month, weekday) { //根据年月周获取该周从周一到周日的日期
				var d = new Date();
				// 该月第一天
				d.setFullYear(year, month - 1, 1);
				var w1 = d.getDay();
				if (w1 == 0) w1 = 7;
				// 该月天数
				d.setFullYear(year, month, 0);
				var dd = d.getDate();
				// 第一个周一
				let d1;
				if (w1 != 1) d1 = 7 - w1 + 2;
				else d1 = 1;
				var monday = d1 + (weekday - 1) * 7;
				var sunday = monday + 6;
				var from = year + "-" + month + "-" + monday;
				var to;
				if (sunday <= dd) {
					to = year + "-" + month + "-" + sunday;
				} else {
					d.setFullYear(year, month - 1, sunday);
					let days = d.getDate();
					to = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + days;
				}
				return monday;
				console.log(weekday + " 从" + from + " 到 " + to + "");
			},
			getMondayTime(year, month, weekday) { //获取每月第几周的周一的日期
				var d = new Date();
				// 该月第一天
				d.setFullYear(year, month - 1, 1);
				var w1 = d.getDay();
				if (w1 == 0) w1 = 7;
				// 该月天数
				d.setFullYear(year, month, 0);
				var dd = d.getDate();
				// 第一个周一
				let d1;
				if (w1 != 1) d1 = 7 - w1 + 2;
				else d1 = 1;
				var monday = d1 + (weekday - 1) * 7;
				return monday;
			},
			getMonDate() { //获取周一的日期
				var d = new Date(),
					day = d.getDay(),
					date = d.getDate();
				if (day == 1)
					return d;
				if (day == 0)
					d.setDate(date - 6);
				else
					d.setDate(date - day + 1);
				return d;
			},
			getDayName(day) { //获得周期名字
				var day = parseInt(day);
				if (isNaN(day) || day < 0 || day > 6)
					return false;
				var weekday = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
				return weekday[day];
			},
			getMonthWeek(a, b, c) { //获得当前日期在当月第几周
				var date = new Date(a, parseInt(b) - 1, c),
					w = date.getDay(),
					d = date.getDate();
				return Math.ceil(
					(d + 6 - w) / 7
				);
			},
			getLastDay(year, month) { //获取当月最后一天日期
				var new_year = year; //取当前的年份
				var new_month = month++; //取下一个月的第一天，方便计算（最后一天不固定）
				if (month > 12) {
					new_month -= 12; //月份减
					new_year++; //年份增
				}
				var new_date = new Date(new_year, new_month, 1); //取当年当月中的第一天
				return (new Date(new_date.getTime() - 1000 * 60 * 60 * 24)).getDate(); //获取当月最后一天日期
			},
			showDate() {
				var that = this;
				var d = this.getMonDate();
				var ds = new Date();
				var arr = [];
				for (var i = 0; i < 7; i++) {
					let weekDay = this.getDayName(d.getDay());
					let date = d.getDate();
					if (weekDay == '周一') {
						let beginTime = ds.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
						that.state.beginTime = beginTime;
					}
					if (weekDay == '周日') {
						let endTime = ds.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
						that.state.endTime = endTime;
					}
					arr.push({
						weekDay: weekDay,
						date: date
					});
					d.setDate(d.getDate() + 1);
				}
				let month = ds.getMonth() + 1;
				let weeks = this.getMonthWeek(ds.getFullYear(), month, ds.getDate());
				//每月周一日期
				let oneDate = that.getMondayTime(ds.getFullYear(), month, 1);
				let weekNum = this.getWeeks(ds.getFullYear(), month); //当前月有几周
			
				if (ds.getDate() < oneDate) {
					month = ds.getMonth();
					weeks = this.getWeeks(ds.getFullYear(), month);
				}
			
				this.weekList.length = weekNum
				this.dayList = arr;
				this.yearDate = ds.getFullYear();
				this.monthDate = month
				switch (weeks) {
					case 1:
						this.week = this.weekList[0];
						break;
					case 2:
						this.week = this.weekList[1];
						break;
					case 3:
						this.week = this.weekList[2];
						break;
					case 4:
						this.week = this.weekList[3];
						break;
					case 5:
						this.week = this.weekList[4];
						break;
					case 6:
						this.week = this.weekList[5];
						break;
				}
			},
			cweekday(wday) {
				var hzWeek = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日");
				return hzWeek[wday];
			},
			isShowWeek() {
				if (this.showWeek == true) {
					this.showWeek = false
				} else {
					this.showWeek = true
				}
			},
			chooseWeek(index, type) {
				this.week = this.weekList[index]
				let days = new Date(this.yearDate, this.monthDate, 0).getDate()
				var startDay = this.getWeekTime(this.yearDate, this.monthDate, index + 1)
				for (var i = 0; i < 7; i++) {
					this.dayList[i].date = startDay;
					startDay++;
					if (startDay > days) {
						startDay = 1
					}
				}
				this.getClass()
			},
			change(e) {
				this.current = e.detail.current;
			},
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
		}
	}
</script>

<style scoped>
	.fixed-box {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 9999;
	}

	.fixedbox {
		width: 100%;
		position: relative;
		top: 0;
		left: 0;
		background: #FFFFFF;
		/* z-index: 999; */
	}

	.bg {
		height: 410upx;
		width: 100%;
	}

	.head {
		display: flex;
		position: absolute;
		top: 72upx;
		align-items: center;
		justify-content: space-between;
		padding: 0 24upx;
		width: 100%;
		color: #FFFFFF;
		box-sizing: border-box;
	}

	.head_left1 {
		display: flex;
		align-items: center;
		font-size: 32upx;
	}

	.head_left1 image {
		width: 20upx;
		height: 36upx;
		margin-right: 10upx;
	}

	.head_right1 {
		width: 88upx;
	}

	.card {
		position: absolute;
		width: 602upx;
		height: 356upx;
		border-radius: 20upx;
		overflow: hidden;
		top: 150upx;
		right: 74upx;
	}

	.swiper-box {
		height: 356upx;
	}

	swiper-item {
		position: relative;
	}

	.video_box {
		width: 602upx;
		height: 356upx;
	}

	.language {
		position: absolute;
		background: #46CECF;
		font-size: 28upx;
		color: #FFFFFF;
		text-align: center;
		padding: 4upx 6upx;
		right: 24upx;
		top: 44upx;
		border-radius: 6upx;
		z-index: 8000;
	}

	.menu_box {
		width: 100%;
		background-color: white;
		height: 100upx;
		display: flex;
		justify-content: space-around;
		align-items: center;
		color: #999999;
		font-size: 30upx;
		padding-top: 90upx;
	}

	.fontActive {
		color: #46CECF;
	}

	.data-active {
		height: 6upx;
		background-color: #46CECF;
		border-radius: 8upx;
		position: relative;
		top: 25upx;
	}


	.message_box {
		margin-top: 20upx;
	}

	.first_box {
		padding-top: 630upx;
	}

	.message_item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 24upx;
		height: 88upx;
		width: 100%;
		line-height: 88upx;
		color: #333333;
		font-size: 32upx;
		background: #FFFFFF;
		box-sizing: border-box;
		border-bottom: 1upx solid #E6E6E6;
	}

	.right_text {
		color: #999999;
	}

	.pingfen {
		display: flex;
		align-items: center;
	}

	.pingfen text {
		color: #FCC732;
		font-size: 42upx;
		margin-left: 30upx;
	}

	.message_me {
		display: flex;
		flex-direction: column;
		background: #FFFFFF;
		padding: 28upx 24upx;
	}

	.me_body {
		background: #F7F7F7;
		width: 658upx;
		padding: 15upx 22upx;
		font-size: 28upx;
		color: #333333;
		margin-top: 24upx;
	}

	.btn_box {
		background: #FFFFFF;
		width: 100%;
		height: 120upx;
		text-align: center;
		margin-top: 20upx;
		padding-top: 26upx;
	}

	.btn {
		border-radius: 39upx;
	}
	
	
	
	/* 课程表 */
	.teble_box {
		background: #FFFFFF;
		width: 100%;
	}
	
	.teble_item {
		display: flex;
		border: 1upx solid #46CECF;
		border-top: none;
	}
	
	.teble_item:nth-child(1) {
		border-top: 1upx solid #46CECF;
	}
	
	.title_left {
		width: 17%;
		height: 150upx;
		border-right: 1upx solid #46CECF;
		color: #333333;
		font-size: 28upx;
		word-wrap: break-word;
		font-weight: bold;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		padding: 0 17upx;
	}
	
	.title_right {
		display: flex;
		flex-direction: column;
		/* border: 1upx solid #46CECF; */
		width: 83%;
	}
	
	.title_right image {
		width: 23upx;
		height: 12upx;
		margin-left: 10upx;
	}
	
	.title_week {
		display: flex;
		align-items: center;
		justify-content: center;
		border-bottom: 1upx solid #46CECF;
		height: 50%;
		color: #46CECF;
		font-size: 32upx;
		font-weight: bold;
		position: relative;
	}
	
	.title_class {
		display: flex;
		justify-content: center;
		align-items: center;
		color: #333333;
		font-size: 28upx;
		height: 50%;
	}
	
	.class_day {
		border-right: 1upx solid #46CECF;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		text-align: center;
		color: #333333;
		font-size: 28upx;
		width: 17%;
		padding: 0 16upx;
	}
	
	.text_day {
		color: #999999;
		font-size: 22upx;
	
	}
	
	.class_anpai {
		color: #46CECF;
		font-size: 28upx;
		display: flex;
		justify-content: center;
		align-items: center;
		border-right: 1upx solid #46CECF;
		padding: 0 8upx;
		white-space: nowrap
	}
	
	.class_box {
		/* border:1upx solid #46CECF ; */
		display: flex;
		height: 106upx;
	}
	
	.class_item {
		width: 160upx;
		border-right: 1upx solid #46CECF;
		color: #666666;
		font-size: 20upx;
		text-align: center;
		line-height: 106upx;
		height: 106upx;
		/* border-top: 1upx solid #46CECF; */
	}
	
	.class_item2 {
		/* line-height: 0;/ */
		width: 160upx;
		display: flex;
		align-items: center;
		flex-direction: column;
		color: #FF0000;
		font-size: 20upx;
		border-top: 1upx solid #46CECF;
	}
	
	.class_item2 text {
		width: 160upx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		text-align: center;
	}
	
	.class_item:nth-child(3) {
		border-right: none;
	}
	
	.class_big {
		display: flex;
		flex-direction: column;
		width: 800upx;
	}
	
	.class_box:nth-child(2) .class_item {
		border-top: 1upx solid #46CECF;
	}
	
	.week_box {
		background: #FFFFFF;
		border: 1upx solid #46CECF;
		position: absolute;
		display: flex;
		flex-direction: column;
		top: 65upx;
		right: 228upx;
	}
	
	.week_box text {
		color: #000000;
		font-size: 28upx;
		border-bottom: 1upx solid #E6E6E6;
		text-align: center;
		width: 120upx;
		text-align: center;
		height: 50upx;
		line-height: 50upx;
		padding: 10upx;
	}
	
	.noList {
		color: #CCCCCC;
		font-size: 26upx;
		line-height: 300upx;
		text-align: center;
		width: 100%;
	}
	
	.status1 {
		line-height: 50upx;
		display: flex;
		align-items: center;
		justify-content: space-around;
		flex-direction: column;
		background: #F5F5F5;
		color: #333333;
	}
	
	.status4 {
		background: #F5D556;
		color: #FFFFFF;
	}
	
	.status5 {
		background: #F5B356;
		color: #FFFFFF;
	}
	
	
	
	/* 评论 */
	.comment_box {
		background: #FFFFFF;
		padding: 35upx 54upx;
		border-bottom: 1upx solid #E6E6E6;
	}
	
	.comment_title {
		color: #333333;
		font-size: 28upx;
		font-weight: bold;
	}
	
	.comment_people {
		display: flex;
		margin: 10upx 0;
	}
	
	.headImg {
		width: 41upx;
		height: 41upx;
		border-radius: 50%;
		overflow: hidden;
		margin-right: 8upx;
	}
	
	.name_box {
		font-size: 20upx;
		color: #999999;
		display: flex;
	}
	
	.returnto {
		margin: 0 18upx;
	}
	
	.grade_box {
		display: flex;
		align-items: center;
		font-size: 20upx;
		color: #999999;
	}
	
	.comment_first {
		color: #333333;
		font-size: 26upx;
		padding-left: 50upx;
	}
	
	.comment_two {
		padding: 28upx 24upx;
		background: #E6E6E6;
		width: 522upx;
		margin-left: 50upx;
		margin-top: 10upx;
	}
	
	.margin2 {
		margin-left: 10upx;
	}
	
	.text4 {
		color: #333333;
		font-size: 26upx;
	}
	
	.delete {
		color: #4299DC;
		font-size: 20upx;
	}
	
	.time {
		color: #999999;
		font-size: 20upx;
		margin: 0 20upx;
	}
	
	
	/* 资料视频 */
	
	.mid_item {
		background: #FFFFFF;
		width: 100%;
		padding: 0 24upx;
		box-sizing: border-box;
		padding-bottom: 20upx;
		text-align: center;
	}
	
	.body_top_item {
		display: flex;
		align-items: center;
		height: 78upx;
		box-sizing: border-box;
	}
	
	.text3 {
		color: #333333;
		font-size: 32upx;
		font-weight: bold;
		margin-right: 60upx;
	}
	
	.body_item_right {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 73%;
		font-size: 32upx;
		color: #333333;
	}
	
	.body_item_right image {
		width: 16upx;
		height: 28upx;
	}
	
	.selected-img {
		width: 602upx;
		height: 356upx;
		border-radius: 20upx;
		overflow: hidden;
	}
	
	.mid_item .proveText {
		text-align: left;
		width: 100%;
		padding: 30upx 0 20upx 0;
	}
</style>
